<?php

namespace App\Library\Requests\ProductOrder;

use App\Library\Requests\Base\BaseDTORequest;
use App\Library\Rules\SerialNumbersRule;
use App\Library\Rules\SpecRule;
use App\Library\Rules\SpecsRule;

class ProductOrderCreateRequest extends BaseDTORequest
{
    public function rules(): array
    {
        return [
            'isCart' => 'required|boolean',
            'addressId' => 'required|integer|min:1',
            'code' => 'required|string|size:32|regex:' . __('com.codeReg'),
            'specArr' => ['required', 'array', new SpecRule],
            'remark' => 'nullable|string|max:200',
            'inviteCode' => 'nullable|string|size:6|regex:' . __('com.inviteCodeReg'),
            'couponNumber' => 'nullable|string|size:20|regex:' . __('com.serialNumberReg'),
        ];
    }
}
